
module.exports = app => {
  app.router.redirect('/', '/recruitment/swagger-ui.html', 302)

  const apiV1Router = app.router.namespace(app.config.baseUrl)
  /** 用户和权限模块 */
  apiV1Router.post('/login', app.controller.auth.login) // 登录
  apiV1Router.post('/register', app.controller.auth.register) // 注册
  apiV1Router.post('/refreshToken', app.controller.auth.refreshToken) // 刷新token
  apiV1Router.get('/userList', app.controller.user.getUserList) // 获取用户列表
  apiV1Router.get('/myInfo', app.controller.user.myInfo) // 获取个人信息
  apiV1Router.put('/myInfo', app.controller.user.modifyInfo) // 修改个人信息
  apiV1Router.delete('/user/delete', app.controller.user.deleteUser) // 删除用户

  /** 课程模块 */
  apiV1Router.get('/courseList', app.controller.moocCourse.getCourseList) // 获取课程列表
  apiV1Router.get('/courseDetail', app.controller.moocCourse.getCourseDetail) // 获取课程详情
  apiV1Router.get('/course/commentList', app.controller.moocCourse.getCommentList) // 获取课程评论列表
  apiV1Router.get('/teacherList', app.controller.moocCourse.getTeacherList) // 获取教师列表
  apiV1Router.get('/majorClass', app.controller.moocCourse.getMajorClass) // 获取课程类别
  apiV1Router.get('/course/terminfoList', app.controller.moocCourse.getTerminfoList) // 获取课程分期
  apiV1Router.post('/remove/teacher', app.controller.moocCourse.removeTeacher) // 清除重复的教师信息

  /** 爬虫接口 */
  apiV1Router.post('/crawler/column', app.controller.crawler.column.updateColumn) // 更新栏目
  apiV1Router.post('/crawler/category', app.controller.crawler.category.updateCategory) // 更新课程分类
  apiV1Router.post('/crawler/course', app.controller.crawler.course.updateCourse) // 更新课程
  apiV1Router.post('/crawler/comment', app.controller.crawler.comment.updateComment) // 更新课程评论
  apiV1Router.post('/crawler/teacher', app.controller.crawler.teacher.updateTeacher) // 更新教师
  apiV1Router.post('/crawler/terminfo', app.controller.crawler.terminfo.updateTerminfo) // 更新课程期数

  /** 统计模块 */
  apiV1Router.get('/statistics/tree', app.controller.statistics.tree.index) // 获取侧边栏
  apiV1Router.get('/statistics/home', app.controller.statistics.home.index) // 获取首页数据
  apiV1Router.get('/statistics/column_to_course', app.controller.statistics.analyze.getColumnToCourseData) // 获取课程栏目对应课程数据
  apiV1Router.get('/statistics/category_to_course', app.controller.statistics.analyze.getCategoryToCourseData) // 获取类别对应课程数据
  apiV1Router.get('/statistics/courseComment', app.controller.statistics.analyze.getCourseComment) // 统计课程评论数
  apiV1Router.get('/statistics/category_to_person', app.controller.statistics.analyze.getCategoryToPersonData) // 统计分类不同时间的参课人数

  apiV1Router.get('/statistics/terminfo_to_person', app.controller.statistics.analyze.getTerminfoToPersonData) // 统计每期课程参课人数
  apiV1Router.get('/statistics/week_log', app.controller.statistics.analyze.getWeekLog) // 统计每周爬取数量
  apiV1Router.get('/statistics/plan_stage', app.controller.statistics.analyze.getplanStage) // 统计每周爬取数量

  /** 日志模块 */
  apiV1Router.get('/log/logList', app.controller.log.index.getLogList) // 获取日志模块
  apiV1Router.post('/log/addTask', app.controller.log.task.addTask) // 添加任务
  apiV1Router.get('/log/getTaskList', app.controller.log.task.getTaskList) // 获取任务列表
  apiV1Router.post('/log/removeTask', app.controller.log.task.removeTask) // 获取任务列表
}
